﻿using System;
using System.Windows;
using System.Windows.Media;

namespace 地图哇哇哇.地图
{
    public class 基块
    {
        public static Size 基尺 = new Size(10, 10);

        public static 地图尺寸 获取容器尺寸(Size 容器尺寸, 基块 块)
        {
            var re = new 地图尺寸();
            if (!容器尺寸.合格吗(100) || 块 == null || !块.尺寸.合格吗(1))
                return re;
            re.横长 = (int) Math.Floor(容器尺寸.Width / 块.尺寸.Width);
            re.纵长 = (int) Math.Floor(容器尺寸.Height / 块.尺寸.Height);
            re.格长度 = 块.尺寸.Width;
            return re;
        }

        private string _编号;
        private Point _位置;
        private Thickness _边框粗细;
        private 地形类型 _地形类型 = 地形类型.无;
        private bool _显示 = true;
        public bool 显示
        {
            get => _显示;
            set => _显示 = value;
        }

       

        public 地形类型 地形类型
        {
            get => _地形类型;
            set => _地形类型 = value;
        }

        public Thickness 边框粗细
        {
            get => _边框粗细;
            set => _边框粗细 = value;
        }

        public Size 尺寸 { get; set; } = 基尺;

        public Point 位置
        {
            get => _位置;
            set => _位置 = value;
        }

        public string 编号
        {
            get => _编号;
            set => _编号 = value;
        }
    }

    public class 地形
    {
        private Brush _材质画笔;

        public Brush 材质画笔
        {
            get => _材质画笔;
            set => _材质画笔 = value;
        }

        public static readonly 地形 陆地 = new 地形 {材质画笔 = Brushes.DarkGray};
        public static readonly 地形 耕地 = new 地形 {材质画笔 = Brushes.Tan};
        public static readonly 地形 林地 = new 地形 {材质画笔 = Brushes.DarkGreen};
        public static readonly 地形 山地 = new 地形 {材质画笔 = Brushes.Olive};

        public static readonly 地形 水域 = new 地形 {材质画笔 = Brushes.CadetBlue};
        public static readonly 地形 湖泊 = new 地形 {材质画笔 = Brushes.Aqua};
        public static readonly 地形 河流 = new 地形 {材质画笔 = Brushes.LimeGreen};
        public static readonly 地形 海洋 = new 地形 {材质画笔 = Brushes.LightSeaGreen};

        public static readonly 地形 其它 = new 地形 {材质画笔 = Brushes.DarkMagenta};
    }

    public enum 地形类型
    {
        无,
        陆地,
        耕地,
        林地,
        山地,
        水域,
        湖泊,
        河流,
        海洋,
        其它
    }
}